package com.txc.books.exception;

/**
 * 基础异常类，扩展于{@link RuntimeException}运行时异常，系统中所有的业务层面异常都应是这个类或其子类的对象。
 *
 * @author xkxu
 */
public class BaseException extends RuntimeException {

	private static final long serialVersionUID = 2087985250386141377L;

	private String errorCode;

	private ExceptionCode exceptionCode;

	public BaseException() {
		super();
	}

	public BaseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
		super(message, cause, enableSuppression, writableStackTrace);
	}

	public BaseException(String message, Throwable cause) {
		super(message, cause);
	}

	public BaseException(String message) {
		super(message);
	}

	public BaseException(Throwable cause) {
		super(cause);
	}

	public BaseException(String message, String errorCode) {
		super(message);
		this.errorCode = errorCode;
	}


	public BaseException(ExceptionCode exceptionCode) {
		this(exceptionCode.getMessage(), exceptionCode.getCode());
	}
	public String getErrorCode() {
		return this.errorCode;
	}
}
